import ReactDOM from 'react-dom/client';
import './index.css';
import { StyleProvider } from '@ant-design/cssinjs';
import { ConfigProvider } from 'antd';
import zhCN from 'antd/locale/zh_CN';
import { Toaster } from 'react-hot-toast';
import { BrowserRouter, Route, Routes } from 'react-router';
import App from './App';
import Admin from './pages/Admin.tsx';
import Customer from './pages/Customer.tsx';
import Login from './pages/Login.tsx';

const rootEl = document.getElementById('root');
if (rootEl) {
  const root = ReactDOM.createRoot(rootEl);
  root.render(
    <>
      <div>
        <Toaster />
      </div>
      <ConfigProvider locale={zhCN}>
        <StyleProvider layer>
          <BrowserRouter>
            <Routes>
              <Route path="/" element={<App />} />
              <Route path="/login" element={<Login />} />
              <Route path="/customer" element={<Customer />} />
              <Route path="/admin" element={<Admin />} />
            </Routes>
          </BrowserRouter>
        </StyleProvider>
      </ConfigProvider>
      ,
    </>,
  );
}
